package com.lagou.edu.server;

import com.lagou.edu.server.HttpServlet;

/**
 * @author 胡益文
 * @since 2021/10/13 15:04
 */
public class Wrapper extends LifecycleBase{
    protected String url = null;
    protected String servletClass = null;

    protected HttpServlet httpServlet = null;
    protected Context context = null;

    public Wrapper(String url, String servletClass, Context context) {
        this.url = url;
        this.servletClass = servletClass;
        this.context = context;
    }


    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getServletClass() {
        return servletClass;
    }

    public void setServletClass(String servletClass) {
        this.servletClass = servletClass;
    }

    @Override
    protected void initInternal() throws Exception {

    }

    @Override
    protected void startInternal() throws Exception {
        Class<?> aClass = context.classLoader.loadClass(servletClass);
        httpServlet = (HttpServlet) aClass.newInstance();
        System.out.println(".........."+aClass.getMethod("doGet",Request.class,Response.class).toGenericString());
    }
}
